home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5162 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  62 lines

  1. Path: news.microsoft.com!news
  2. From: a-cnadc@microsoft.com (Dann Corbit)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP!! Urgent Borland 4.5 problem
  5. Date: 7 Feb 1996 22:11:10 GMT
  6. Organization: Microsoft Corporation
  7. Message-ID: <4fb81u$91a@news.microsoft.com>
  8. References: <311759F5.41C67EA6@ap.co.umist.ac.uk>
  9. NNTP-Posting-Host: 157.57.171.202
  10. Mime-Version: 1.0
  11. X-Newsreader: WinVN 0.93.14
  12.  
  13. In article <311759F5.41C67EA6@ap.co.umist.ac.uk>, =-dan-= says...
  14. >
  15. >I've got a majour problem which I can't find the
  16. >answer to ANYWHERE!!
  17. >
  18. >How do you (in v4.5) have one source code which
  19. >uses functions you wrote yourself but must be 
  20. >stored in a different file.
  21. You may have already explored this, but did you include
  22. the prototypes for the functions stored in a different
  23. file into the file that uses them using an include file?
  24.  
  25. e.g.
  26.  
  27. file1.c :
  28. ---------
  29. #include "myfuncs.h"
  30. int f1( int iVal )
  31. {
  32.    return iVal--;
  33. }
  34. int f2( int iVal )
  35. {
  36.    return iVal++;
  37. }
  38.  
  39. file2.c :
  40. ---------
  41. #include <stdio.h>
  42. #include "myfuncs.h"
  43. int main()
  44. {
  45.    int iVal;
  46.    iVal = 2;
  47.    iVal = f1( iVal );
  48.    printf( "iVal after f1:%d\n", iVal );
  49.    iVal = f1( iVal );
  50.    printf( "iVal after f2:%d\n", iVal );
  51. }
  52.  
  53. myfuncs.h :
  54. -----------
  55. int f1( int iVal );
  56. int f2( int iVal );
  57.  
  58. -- 
  59. The opinions expressed in this message are my own personal views 
  60. and do not reflect the official views of Microsoft Corporation.
  61.  
  62.